# coding: utf-8
# DO NOT IMPORT ANYTHING EXCEPT OTHER CONSTANTS


# === common constants
# from datastructures import AppVersion

str_to_int = {
    'true': 1,
    'false': 0,
}


class Enum(object):
    def __init__(self, *args, **kwargs):
        self.__dict__.update(
            dict(zip(args, range(len(args))), **kwargs)
        )

    def inv_dict(self):
        d = self.__dict__.values()
        if len(d) != len(set(d)):
            raise "Cannot reverse key-value because the Enum obj has duplicated values."
        return {v: k for k, v in self.__dict__.iteritems()}

    def sorted_names(self):
        return sorted(self.names(),
                      lambda a, b: cmp(self.__dict__[a], self.__dict__[b]))

    def sorted_values(self):
        return sorted(self.values())

    def names(self):
        return self.__dict__.keys()

    def values(self):
        return self.__dict__.values()

    def get(self, key, default=None):
        return self.__dict__.get(key, default)

    def __contains__(self, key):
        return key in self.values()


TARGET_TYPES = Enum()
TARGET_TYPES.TRIP = "trip"  # 旅程
TARGET_TYPES.WAYPOINT = "waypoint"  # 路点
TARGET_TYPES.TALENT = "talent"  # 达人页面
TARGET_TYPES.USER = "user"  # 用户
TARGET_TYPES.POI = "poi"  # POI
TARGET_TYPES.WONDERFUL = "wonderful"  # 精彩内容推荐
TARGET_TYPES.BTCOMMENT = "btcomment"  # 活动页面评论
TARGET_TYPES.DESTINATION = "destination"  # 目的地
TARGET_TYPES.SPOT = "spot"  # SPOT

CONTENT_TYPES = TARGET_TYPES

TINYSITE_TYPES = Enum()
TINYSITE_TYPES.NONE = 0
TINYSITE_TYPES.COUNTRY = 1
TINYSITE_TYPES.PROVINCE = 2
TINYSITE_TYPES.CITY = 3
TINYSITE_TYPES.ATTRACTION = 4
TINYSITE_TYPES.POI = 5

HAVE_BEEN_TO_TYPES = Enum()
HAVE_BEEN_TO_TYPES.NEGATIVE = 1
HAVE_BEEN_TO_TYPES.POSITIVE = 2

user_agents = Enum()
user_agents.DEFAULT = 0
user_agents.IPHONE = 1
user_agents.IPAD = 2
user_agents.IPOD = 3
user_agents.ANDROID = 4

mobile_view_spec = {
    user_agents.DEFAULT: {},
    user_agents.IPHONE: {
        'device_label': 'iPhone',
        'download_btn_class': 'iphone',
        'download_app_type': 'ios',
        'download_src': 'iphone',
    },
    user_agents.IPOD: {
        'device_label': 'iPhone',
        'download_btn_class': 'iphone',
        'download_app_type': 'ios',
        'download_src': 'iphone',
    },
    user_agents.IPAD: {
        'device_label': 'iPhone',
        'download_btn_class': 'iphone',
        'download_app_type': 'ios',
        'download_src': 'iphone',
    },
    user_agents.ANDROID: {
        'device_label': 'Android',
        'download_btn_class': 'android',
        'download_app_type': 'android',
        'download_src': 'android',
    },
}

DEVICE_TYPES = Enum()
# Iphone version
DEVICE_TYPES.IOS = 0
DEVICE_TYPES.ANDROID = 1
DEVICE_TYPES.BAIDU_CHANNEL = 2
DEVICE_TYPES.IOS_IPAD = 3
DEVICE_TYPES.VACATION_BAIDU_CHANNEL = 4
DEVICE_TYPES.VACATION_IOS_DEVICE_TOKEN = 5
DEVICE_TYPES.COLLECTION_IOS = (DEVICE_TYPES.IOS, DEVICE_TYPES.IOS_IPAD)
DEVICE_TYPES.VACATION_BAIDU_CHANNEL = 4
DEVICE_TYPES.VACATION_IOS_DEVICE_TOKEN = 5


# 和设备类型不同，SOURCE_TYPES主要表示来源是什么设备
SOURCE_TYPES = Enum()
SOURCE_TYPES.UNKNOWN = 0
SOURCE_TYPES.WEB = 1
SOURCE_TYPES.IOS = 2
SOURCE_TYPES.ANDROID = 3

PAYMENT_TYPES = Enum()
# 也可以称为TRANSACTION_TYPES
PAYMENT_TYPES.ALIPAY = 1  # 支付宝
PAYMENT_TYPES.BREADTRIP_POINT = 2  # 面包积分
PAYMENT_TYPES.SOOPAY = 3  # 联动优势支付
PAYMENT_TYPES.WXPAY = 4  # 微信支付

PAYMENT_TYPE_NAMES = {
    PAYMENT_TYPES.ALIPAY: u'支付宝',
    PAYMENT_TYPES.BREADTRIP_POINT: u'面包积分',
    PAYMENT_TYPES.SOOPAY: u'联动优势支付',
    PAYMENT_TYPES.WXPAY: u'微信支付',
}

ORDER_TYPES = Enum()
ORDER_TYPES.TRIP_PRODUCT = 1  # 旅行产品订单
ORDER_TYPES.BREADTRIP_POINT = 2  # 面包积分订单
ORDER_TYPES.UHAVE = 3
ORDER_TYPES.COUPON_CODE = 4  # 优惠码订单
ORDER_TYPES.VIRTUAL_PRODUCT_CODE = 5  # 虚拟产品兑换码订单

ORDER_TYPES_CLASS_MAP = {
    ORDER_TYPES.TRIP_PRODUCT: ('apps.tripproduct.models',
                               'Order'),
    ORDER_TYPES.BREADTRIP_POINT: ('apps.payment.models',
                                  'BreadtripPointOrder'),
    ORDER_TYPES.UHAVE: ('apps.payment.models',
                        'UhaveBookOrder'),
    ORDER_TYPES.COUPON_CODE: ('apps.payment.models',
                              'CouponCodeOrder'),
    ORDER_TYPES.VIRTUAL_PRODUCT_CODE: ('apps.tripproduct.models',
                                       'VirtualProductCodeOrder'),
}

# 1分钱订单邮箱
ONE_CENT_ORDER_EMAIL = '100million@breadtrip.com'

# 支付帐号类型
PAYMENT_PARTNER_TYPES = Enum()
PAYMENT_PARTNER_TYPES.BREADTRIP = 1
PAYMENT_PARTNER_TYPES.SHANSHUIJIARI = 2
PAYMENT_PARTNER_TYPES.TONGHESIJI = 3

PAYMENT_PARTNER_TYPE_NAMES = {
    PAYMENT_PARTNER_TYPES.BREADTRIP: u'面包旅行',
    PAYMENT_PARTNER_TYPES.SHANSHUIJIARI: u'山水假日',
    PAYMENT_PARTNER_TYPES.TONGHESIJI: u'同和四季',
}

TRANSACTION_STATUS = Enum()
TRANSACTION_STATUS.IN_PROGRESS = 1  # 已转至第三方
TRANSACTION_STATUS.SUCCESS = 2  # 支付成功
TRANSACTION_STATUS.FAIL = 3  # 支付失败
# TRANSACTION_STATUS.ABORT = 4        # 支付中止
# TRANSACTION_STATUS.CANCEL = 5       # 支付取消
TRANSACTION_STATUS.REFUNDED = 6  # 已退款（用于人工退款，
# 由于没有退款的transaction，所以要标记一下）

# 旅行产品订单状态
ORDER_STATUS = Enum()
ORDER_STATUS.AUTO_INVALID = 0  # 下单失败。
# 用于参数校验失败后，系统自动设置
# 人工校验失败后，应设置为 CANCELED

ORDER_STATUS.DEFAULT = 1  # 下单，等待支付

ORDER_STATUS.CALLBACK = 2  # 已得到支付平台页面的callback，等待支付平台验证
# 有的时候支付平台的callback是GET方法，
# 没有加密，还会有异步的校验，有加密信息
# 测试需要等待异步校验完成，才能更改订单状态

ORDER_STATUS.PAID = 3  # 完成支付，等待确认

# ORDER_STATUS.CONFIRMED = 4              # 已确认，等待支付
#                                        # 暂未使用：为了将来“先确认再支付”的情况预留

ORDER_STATUS.CONFIRMED_AND_PAID = 5  # 完成支付并确认

ORDER_STATUS.CANCELLED = 6  # 已取消

ORDER_STATUS.REFUNDED = 7  # 已退款

ORDER_STATUS.AUTO_CANCELLED = 8  # 订单过期，长时间未支付等原因

ORDER_STATUS.CONFIRM = 9  # 待商家确认

ORDER_STATUS.PAID_AND_HUNTER_CONFIRMED = 10  # 猎人确认 (区分客服确认)
ORDER_STATUS.PAID_AND_HUNTER_REFUSED = 11  # 猎人拒绝待退款 (区分客服取消)
ORDER_STATUS.USER_CANCELLED = 12  # 用户取消 (区分客服取消)

ORDER_STATUS.ORDER_PERFECT_COMPLETED = 50  # 订单已完成

# 订单被购买的状态（包括付款与未付款的）
ORDER_STATUS_COLLECTION_SOLD = (ORDER_STATUS.DEFAULT,
                                ORDER_STATUS.CALLBACK,
                                ORDER_STATUS.PAID,
                                # ORDER_STATUS.CONFIRMED,
                                ORDER_STATUS.CONFIRMED_AND_PAID)

# 无效的订单状态
INVALID_ORDER_STATUS_COLLECTION = (
    ORDER_STATUS.CANCELLED,
    ORDER_STATUS.REFUNDED,
    ORDER_STATUS.AUTO_CANCELLED,
    ORDER_STATUS.USER_CANCELLED,
)

# 付款且有效的订单状态
PAID_ORDER_STATUS_COLLECTION = (
    ORDER_STATUS.PAID,
    ORDER_STATUS.CONFIRMED_AND_PAID,
    ORDER_STATUS.PAID_AND_HUNTER_CONFIRMED,
    ORDER_STATUS.PAID_AND_HUNTER_REFUSED,
    ORDER_STATUS.ORDER_PERFECT_COMPLETED,
)

ORDER_STATUS_INFO = {
    ORDER_STATUS.AUTO_INVALID: {'label': u'下单失败',
                                'label_s': u'下单失败',
                                'label_l': u'下单失败',
                                'actions': []},
    ORDER_STATUS.CALLBACK: {'label': u'等待支付平台确认',
                            'label_s': u'等待支付平台确认',
                            'label_l': u'等待支付平台确认',
                            'actions': []},
    ORDER_STATUS.DEFAULT: {'label': u'待支付',
                           'label_s': u'待支付',
                           'label_l': u'待支付',
                           'actions': [ORDER_STATUS.REFUNDED]},
    # ORDER_STATUS.PAYING: {'label':  u'正在支付'},
    ORDER_STATUS.PAID: {'label': u'待确认',
                        'label_s': u'待确认',
                        'label_l': u'待确认',
                        'actions': [ORDER_STATUS.CONFIRMED_AND_PAID,
                                    ORDER_STATUS.CANCELLED,
                                    ORDER_STATUS.REFUNDED]},
    # ORDER_STATUS.CONFIRMED: {'label':  u'已确认，等待支付'},
    ORDER_STATUS.CONFIRMED_AND_PAID: {'label': u'已确认',
                                      'label_s': u'已确认',
                                      'label_l': u'已确认',
                                      'actions': [ORDER_STATUS.CANCELLED,
                                                  ORDER_STATUS.REFUNDED,
                                                  ORDER_STATUS.ORDER_PERFECT_COMPLETED]},

    ORDER_STATUS.PAID_AND_HUNTER_CONFIRMED: {'label': u'完成支付且猎人确认',
                                             'label_s': u'已接受',
                                             'label_l': u'已接受',
                                             'actions': [ORDER_STATUS.CANCELLED,
                                                         ORDER_STATUS.REFUNDED,
                                                         ORDER_STATUS.ORDER_PERFECT_COMPLETED]},
    ORDER_STATUS.PAID_AND_HUNTER_REFUSED: {'label': u'完成支付且猎人拒绝',
                                           'label_s': u'已拒绝',
                                           'label_l': u'已拒绝',
                                           'actions': [ORDER_STATUS.CANCELLED,
                                                       ORDER_STATUS.REFUNDED]},
    ORDER_STATUS.CANCELLED: {'label': u'已取消，待退款',
                             'label_s': u'已取消',
                             'label_l': u'已取消',
                             'actions': [ORDER_STATUS.DEFAULT,
                                         ORDER_STATUS.REFUNDED]},
    ORDER_STATUS.REFUNDED: {'label': u'已取消，已退款',
                            'label_s': u'已关闭',
                            'label_l': u'已关闭',
                            'actions': [ORDER_STATUS.DEFAULT]},
    ORDER_STATUS.AUTO_CANCELLED: {'label': u'订单已过期',
                                  'label_s': u'订单已过期',
                                  'label_l': u'订单已过期',
                                  'actions': [ORDER_STATUS.DEFAULT]},

    ORDER_STATUS.CONFIRM: {'label': u'待商户确认',
                           'label_s': u'待商户确认',
                           'label_l': u'待商户确认',
                           'actions': [ORDER_STATUS.DEFAULT,
                                       ORDER_STATUS.REFUNDED]},

    ORDER_STATUS.USER_CANCELLED: {'label': u'用户已取消',
                                  'label_s': u'已取消',
                                  'label_l': u'订单已取消',
                                  'actions': [ORDER_STATUS.CANCELLED,
                                              ORDER_STATUS.REFUNDED]},

    ORDER_STATUS.ORDER_PERFECT_COMPLETED: {'label': u'订单已完成',
                                           'label_s': u'已完成',
                                           'label_l': u'已完成',
                                           'actions': []},
}

# 订单的维权状态
# 用户是否对某订单进行维权投诉
ORDER_FEEDBACK_STATUS = Enum()
ORDER_FEEDBACK_STATUS.NONE = 0  # 用户没有维权
ORDER_FEEDBACK_STATUS.REQUEST = 1  # 用户提出维权
ORDER_FEEDBACK_STATUS.SOLVE = 2  # 已解决
ORDER_FEEDBACK_STATUS.CONFIRM = 3  # 用户确认维权已解决
ORDER_FEEDBACK_STATUS.REJECT = 4  # 用户继续维权

ORDER_FEEDBACK_STATUS_INFO = {
    ORDER_FEEDBACK_STATUS.NONE: {'label': u'',
                                 'actions': []},
    ORDER_FEEDBACK_STATUS.REQUEST: {'label': u'提出维权',
                                    'actions': [ORDER_FEEDBACK_STATUS.SOLVE]},
    ORDER_FEEDBACK_STATUS.SOLVE: {'label': u'已解决',
                                  'actions': []},
    ORDER_FEEDBACK_STATUS.CONFIRM: {'label': u'用户确认',
                                    'actions': []},
    ORDER_FEEDBACK_STATUS.REJECT: {'label': u'用户否认',
                                   'actions': [ORDER_FEEDBACK_STATUS.SOLVE]},
}

# 货币
CURRENCIES = Enum()
# 实际货币，3位大写英文字母 ISO-4217 http://en.wikipedia.org/wiki/ISO_4217
CURRENCIES.CNY = 'CNY'
# 虚拟货币从200开始
CURRENCIES.BTPT = 'BTPT'  # 面包积分
CURRENCIES.CPCD = 'CPCD'  # 优惠码

VACATION_TYPE = Enum()
VACATION_TYPE.OPTION = 0
VACATION_TYPE.ITINARARY = 1
VACATION_TYPE.DESTOPTION = 2
VACATION_TYPE.POI = 3


# 订单管理页面, 过滤状态排序
DASHBOARD_ORDER_STATUS_FILTER_LIST = (
    ORDER_STATUS.AUTO_INVALID,
    ORDER_STATUS.CONFIRM,
    ORDER_STATUS.DEFAULT,
    ORDER_STATUS.CALLBACK,
    ORDER_STATUS.PAID,
    ORDER_STATUS.CONFIRMED_AND_PAID,
    ORDER_STATUS.PAID_AND_HUNTER_CONFIRMED,
    ORDER_STATUS.PAID_AND_HUNTER_REFUSED,
    # TODO: 待猎人点评,待客人点评 排在此位置
    ORDER_STATUS.ORDER_PERFECT_COMPLETED,
    ORDER_STATUS.CANCELLED,
    ORDER_STATUS.REFUNDED,
    ORDER_STATUS.AUTO_CANCELLED,
)


# === vacation constants

ORDER_REMIND_EMAILS = (
    # 'order.all@breadtrip.com',
    'zhengzhijie@breadtrip.com',
)

MTU_TYPE = Enum()
MTU_TYPE.POI = 1
MTU_TYPE.PRODUCT = 2
MTU_TYPE.HOTEL = 3

# GDS 酒店订单状态
# GDS_ORDER_STATUS = {
#     'NEW': 0,                          # 新建订单
#     'NEW_CANCELED': 1,                 # 新建订单 未支付 已取消
#     'PAID_BOOKING': 2,                 # 新建订单 已支付 确认中
#     'PAID_BOOKSUCCEEDED': 3,           # 支付成功 预订成功
#     'PAID_BOOKFAILED_NOTREFUNDED': 4,  # 支付成功 预订失败 未退款
#     'PAID_BOOKFAILED_REFUNDED': 5,     # 支付成功 预订失败 已退款
#     'PAID_CANCELED_NOTREFUNDED': 6,    # 支付成功 已取消 未退款
#     'PAID_CANCELED_REFUNDED': 7,       # 支付成功 已取消 已退款
# }
GDS_ORDER_STATUS = {
    'NEW': 'new',  # 新建订单
    'NEW_CANCELED': 'new_canceled',  # 新建订单 未支付 已取消
    'PAID_BOOKING': 'paid_booking',  # 新建订单 已支付 确认中
    'PAID_BOOKSUCCEEDED': 'paid_booksucceeded',  # 支付成功 预订成功
    'PAID_BOOKFAILED_NOTREFUNDED': 'paid_bookfailed_notrefunded',
    # 支付成功 预订失败 未退款
    'PAID_BOOKFAILED_REFUNDED': 'paid_bookfailed_refunded',  # 支付成功 预订失败 已退款
    'PAID_CANCELED_NOTREFUNDED': 'paid_canceled_notrefunded',  # 支付成功 已取消 未退款
    'PAID_CANCELED_REFUNDED': 'paid_canceled_refunded',  # 支付成功 已取消 已退款
}

LOCALITY_IMAGES = {
    1: [
        'http://photos.breadtrip.com/covers_2015_05_13_b81e050731318b3d5897fedfab74748b.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_be145ccd325a07a1c14188344b6368a2.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_6e00d49a8291bd14a645a6938cc3298c.jpg?imageView/2/w/960/',
    ],
    2: [
        'http://photos.breadtrip.com/covers_2015_05_13_25b3a49efd81de32711b32646565ac9a.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_9149b3d077b35c5041bb81ca3b664faf.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_b60e6e211819f1a89d3d201a7f84455f.jpg?imageView/2/w/960/',
    ],
    3: [
        'http://photos.breadtrip.com/covers_2015_05_13_44dc7093d4938bb0fe974c0912309742.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_ad980fbf003d72ec059e583e8f4190be.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_f02ccdd26c1f76a222324905dc67eb2b.jpg?imageView/2/w/960/',
    ],
    4: [
        'http://photos.breadtrip.com/covers_2015_05_13_65bd33acfca5d31e59382ebda584a583.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_3ff7b5fa2c3021ee5cf50cbe70e54273.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_de21363cb3eb8102bea6b5e8014af76b.jpg?imageView/2/w/960/',
    ],
    5: [
        'http://photos.breadtrip.com/covers_2015_05_13_b220d939d00afed09642c9dad4ba79cf.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_778c8af6b465ffbd7cca8fbde6822d89.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_778c8af6b465ffbd7cca8fbde6822d89.jpg?imageView/2/w/960/',
    ],
    6: [
        'http://photos.breadtrip.com/covers_2015_05_13_d322a2c4e27eec744a679084cd66574c.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_3be90bb3a2f35a435970a5c31b7bbecb.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_6380fbdecb9b426e6506581d1b84232e.jpg?imageView/2/w/960/',
    ],
    7: [
        'http://photos.breadtrip.com/covers_2015_05_13_3cbd69dc43a1ea3a65144ed8b9d649b5.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_9b48c9ba90973cf4aea0c69f525554e9.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_9b48c9ba90973cf4aea0c69f525554e9.jpg?imageView/2/w/960/',
    ],
}

NEW_LOCALITY_IMAGES = {
    'Thailand': [
        'http://photos.breadtrip.com/covers_2015_05_13_b81e050731318b3d5897fedfab74748b.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_be145ccd325a07a1c14188344b6368a2.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_6e00d49a8291bd14a645a6938cc3298c.jpg?imageView/2/w/960/',
    ],
    'Switzerland': [
        'http://photos.breadtrip.com/covers_2015_05_13_25b3a49efd81de32711b32646565ac9a.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_9149b3d077b35c5041bb81ca3b664faf.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_b60e6e211819f1a89d3d201a7f84455f.jpg?imageView/2/w/960/',
    ],
    'Japan': [
        'http://photos.breadtrip.com/covers_2015_05_13_44dc7093d4938bb0fe974c0912309742.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_ad980fbf003d72ec059e583e8f4190be.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_f02ccdd26c1f76a222324905dc67eb2b.jpg?imageView/2/w/960/',
    ],
    'America': [
        'http://photos.breadtrip.com/covers_2015_05_13_65bd33acfca5d31e59382ebda584a583.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_3ff7b5fa2c3021ee5cf50cbe70e54273.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_de21363cb3eb8102bea6b5e8014af76b.jpg?imageView/2/w/960/',
    ],
    'Germany': [
        'http://photos.breadtrip.com/covers_2015_05_13_b220d939d00afed09642c9dad4ba79cf.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_778c8af6b465ffbd7cca8fbde6822d89.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_778c8af6b465ffbd7cca8fbde6822d89.jpg?imageView/2/w/960/',
    ],
    'France': [
        'http://photos.breadtrip.com/covers_2015_05_13_d322a2c4e27eec744a679084cd66574c.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_3be90bb3a2f35a435970a5c31b7bbecb.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_6380fbdecb9b426e6506581d1b84232e.jpg?imageView/2/w/960/',
    ],
    'Italy': [
        'http://photos.breadtrip.com/covers_2015_05_13_3cbd69dc43a1ea3a65144ed8b9d649b5.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_9b48c9ba90973cf4aea0c69f525554e9.jpg?imageView/2/w/960/',
        'http://photos.breadtrip.com/covers_2015_05_13_9b48c9ba90973cf4aea0c69f525554e9.jpg?imageView/2/w/960/',
    ],
}

LOCALITY_SPECIAL_PRODUCTS = {
    1: [776549, 788891],
    2: [843998],
    3: [843998, 818896, 818247],
    4: [843998, 844634],
    5: [843998],
    6: [843998],
    7: [843998],
}

# key: locality_id
# value: product_id
LOCALITY_APPEND_PRODUCTS = {
    1: [73, 72],  # 泰国
    2: [258],  # 瑞士
    3: [258, 213, 166],  # 日本
    4: [258, 184, 335],  # 美国
    5: [258],  # 德国
    6: [258],  # 法国
    7: [258],  # 意大利
}
# key: destination_id
# value: product_id
DESTINATION_APPEND_PRODUCTS = {
    64: [219, 176, 263],  # 东京
    71: [267, 221],  # 大阪
    76: [223, 268],  # 冲绳
    102: [186, 260, 264],  # 纽约
    109: [253, 389],  # 洛杉矶
    13: [82, 83],  # 拜县
    2: [12, 13],  # 普吉
    11: [89, 90],  # 皮皮岛
    109: [382],  # 旧金山
    103: [394],  # 拉斯维加斯
    117: [331],  # 西雅图
    123: [333],  # 波士顿
    116: [380],  # 圣地亚哥
    165: [332],  # 芝加哥
}

STATISTICS_CATEGORIES = Enum()
STATISTICS_CATEGORIES.IS_ITINERARY_PAGE = 1
STATISTICS_CATEGORIES.IS_COMPLETE_ITINERARY = 2
STATISTICS_CATEGORIES.IS_ORDER_PAGE = 3
STATISTICS_CATEGORIES.IS_ORDERED = 4
STATISTICS_CATEGORIES.IS_EDIT_ORDER = 5
STATISTICS_CATEGORIES.IS_PAYMENT_GUIDE = 6

CURRENCY_TO_SYMBOL = {
    'CNY': '¥',
    'EUR': '€',
    'JPY': '円',
    'USD': '$',
    'CHF': 'CHF',
    'THB': '฿',
}

TAG_VERIFY_STATUSES = Enum()
TAG_VERIFY_STATUSES.UNVERIFIED = 0
TAG_VERIFY_STATUSES.VALID = 1
TAG_VERIFY_STATUSES.INVALID = 2
TAG_VERIFY_STATUSES.MIGRATED = 3

# 订单表单属性(related_name关联到用户勾选项的名称，部分勾选项对应多个字段)
# key为后台用户勾选项，relation_name为对应的表单或表字段名
#  后台表productcustomcategory存储
#  前后端json对象传递(tpl_json)
#  订单表productorder, orderdetail
#  check_select为复选框中的选择下拉列表型，与自定义增加部分的下拉列表型select作区分

form_field_dict = {

    # 联系人信息
    'cn_name':
        {
            'category': 'contact',
            'related_name': 'contact_name',
            'name': u'中文姓名',
            'placeholder': u'中文姓名',
            'type': 'text',
            'sort': 1
        },
    'first_name':
        {
            'category': 'contact',
            'related_name':
                'first_name',
            'name': u'护照英文姓',
            'placeholder': u'护照英文姓',
            'type': 'text',
            'sort': 2
        },
    'last_name':
        {
            'category': 'contact',
            'related_name':
                'last_name',
            'name': u'护照英文名',
            'placeholder': u'护照英文名',
            'type': 'text',
            'sort': 3
        },
    'sex':
        {
            'category': 'contact',
            'related_name': 'sex',
            'name': u'性别',
            'placeholder': u'性别',
            'type': 'select',
            'value':
                [{'name': "男", 'value': 0, 'selected': True},
                 {'name': "女", 'value': 1, 'selected': False},
                 ],
            'sort': 4
        },
    'phone':
        {
            'category': 'contact',
            'related_name': 'contact_tel',
            'name': u'联系人手机',
            'placeholder': u'联系人手机',
            'type': 'tel',
            'sort': 5
        },
    'email':
        {
            'category': 'contact',
            'related_name': 'contact_email',
            'name': u'联系人邮箱',
            'placeholder': u'联系人邮箱',
            'type': 'email',
            'sort': 6
        },
    'weixin':
        {
            'category': 'contact',
            'related_name': 'weixin',
            'name': u'微信号',
            'placeholder': u'微信号',
            'type': 'text',
            'sort': 7
        },

    # 基本信息
    'use_date':
        {
            'category': 'extended',
            'related_name': 'date',
            'name': u'使用日期',
            'placeholder': u'使用日期',
            'type': 'url',
            'sort': 1
        },
    'use_days':
        {
            'category': 'basic',
            'related_name': 'use_days',
            'name': u'使用天数',
            'placeholder': u'使用天数',
            'type': 'text',
            'sort': 2
        },
    # 备注/扩展信息
    'flight_number':
        {
            'category': 'extended',
            'related_name': 'flight',
            'name': u'航班号',
            'placeholder': u'航班号',
            'type': 'text',
            'sort': 1
        },
    'user_waiting_time':
        {
            'category': 'extended',
            'related_name': 'user_waiting_time',
            'name': u'候车时间',
            'placeholder': u'候车时间',
            'type': 'time',
            'sort': 2
        },
    'take_off_time':
        {
            'category': 'extended',
            'related_name': 'take_off_time',
            'name': u'起飞时间',
            'placeholder': u'起飞时间',
            'type': 'time',
            'sort': 3
        },
    'arrive_time':
        {
            'category': 'extended',
            'en_name': 'arrive_time',
            'related_name': 'arrive_time',
            'name': u'抵达时间',
            'placeholder': u'抵达时间',
            'type': 'time',
            'otype': 'checkbox',
            'sort': 4
        },
    'hotel_name':
        {
            'category': 'extended',
            'en_name': 'hotel_name',
            'related_name': 'hotel_name',
            'name': u'接送酒店',
            'placeholder': u'接送酒店',
            'type': 'textarea',
            'otype': 'checkbox',
            'sort': 5
        },
    'hotel_address':
        {
            'category': 'extended',
            'en_name': 'hotel_address',
            'related_name': 'hotel_address',
            'name': u'酒店地址',
            'placeholder': u'酒店地址',
            'type': 'textarea',
            'otype': 'checkbox',
            'sort': 6
        },
    'delivery_location':
        {
            'category': 'extended',
            'en_name': 'delivery_location',
            'related_name': 'delivery_location',
            'name': u'送达地点',
            'placeholder': u'送达地点',
            'type': 'textarea',
            'otype': 'checkbox',
            'sort': 7
        },
    'get_on_address':
        {
            'category': 'extended',
            'en_name': 'get_on_address',
            'related_name': 'get_on_address',
            'name': u'上车地点',
            'placeholder': u'上车地点',
            'type': 'textarea',
            'otype': 'checkbox',
            'sort': 8
        },
    'ticket_counter':
        {
            'category': 'extended',
            'en_name': 'ticket_counter',
            'related_name': 'ticket_counter',
            'name': u'取票柜台',
            'placeholder': u'取票柜台',
            'type': 'text',
            'otype': 'checkbox',
            'sort': 9
        },
    # 'admission_time':
    #    {
    #    'category':'extended',
    #    'en_name':'admission_time',
    #    'related_name':'admission_time',
    #    'name':u'入场时间',
    #    'placeholder':u'入场时间',
    #    'type':'text',
    #    'otype':'checkbox',
    #    'sort':10
    #    },
    'shipping_address':
        {
            'category': 'extended',
            'en_name': 'shipping_address',
            'related_name': 'shipping_address',
            'name': u'邮寄地址',
            'placeholder': u'邮寄地址',
            'type': 'textarea',
            'otype': 'checkbox',
            'sort': 11
        },
    'baby_count':  # 婴儿数量始终排在最后
        {
            'category': 'extended',
            'en_name': 'baby_count',
            'related_name': 'baby_count',
            'name': u'婴儿数量',
            'placeholder': u'婴儿数量',
            'type': 'number',
            'otype': 'checkbox',
            'sort': 'z'
        }
}

# allowed image type
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])

# category信息，可能前端会用到
CATEGORY = {
     1: "车辆服务",
     5: "餐厅",
     6: "购物",
     7: "生活服务",
     9: "医疗机构",
     10: "住宿",
     11: "景点",
     12: "商务机构",
     13: "体验",
     14: "科教文化",
     15: "交通",
     19: "楼宇街道",
     21: "休闲娱乐",
}

API_ORDER_ERROR = Enum()
API_ORDER_ERROR.NO_TIME = 1             # 接送机没有填写时间
API_ORDER_ERROR.NO_DATE = 2             # 除电话卡和保险外的旅行产品没有填写日期
API_ORDER_ERROR.NO_FLIGHT = 3           # 送机服务没有填写航班号
API_ORDER_ERROR.INSURE_NO_DATA = 4      # 保险需要填写相关数据
API_ORDER_ERROR.NO_HOTEL = 5            # 酒店接送项目酒店没有填写
API_ORDER_ERROR.DATE_ERROR = 6          # 特殊产品某些日期不能使用
API_ORDER_ERROR.HOTEL_DATE_ERROR = 7    # 酒店在此日期内无法预定

